# Maintainer: sunrisepeak <speakshen@163.com>
pkgname=xlings
pkgver=0.0.4
pkgrel=1
pkgdesc="A Developer's Toolkit for Programming Learning, Development, and Tutorial Creation"
arch=('x86_64')
url="https://github.com/d2learn/xlings"
license=('Apache-2.0')
depends=('xmake')
makedepends=('git')
source=(
    "git+https://github.com/d2learn/xlings.git"
    "xlings-remove.hook"
)
sha256sums=('SKIP' 'SKIP' 'SKIP')

package() {
  cd "$srcdir/$pkgname"

  # Install binary
  install -Dm755 bin/xlings "$pkgdir/usr/bin/xlings"

  # Install all files to /usr/share/xlings
  install -d "$pkgdir/usr/share/$pkgname"
  cp -r . "$pkgdir/usr/share/$pkgname"

  chmod 766 "$pkgdir/usr/share/$pkgname/config/xlings.json"

  # Set permissions for files
  # find "$pkgdir/usr/share/$pkgname" -type f -exec chmod 644 {} +
  # find "$pkgdir/usr/share/$pkgname" -type d -exec chmod 755 {} +

  # Add hooks
  install -Dm644 ../xlings-remove.hook "$pkgdir/usr/share/libalpm/hooks/xlings-remove.hook"
}